import React,{PureComponent} from 'react'
import {View,Image,StyleSheet,TouchableOpacity,TextInput,Text,Dimensions,Button,Platform} from 'react-native'
const {width} = Dimensions.get('window')

type Props = {
    course:Object,
    coupon:Object,
}
export default class OrderJieSuanView extends PureComponent<Props>{
    constructor(props){
        super(props)
        this.state = {
            payShow:false,
            distinct:0,
        }
    }
    render(){
        const {course} = this.props
        var price = course.price
        var youhui = 0
        if (this.props.coupon){
            price = (course.price-this.props.coupon.price)<=0 ? 0: (course.price-this.props.coupon.price)
            youhui = -this.props.coupon.price
        }
        return (
            <View style={{backgroundColor:'white',flex:1}}>
                <View style={{flexDirection:'row',backgroundColor:'rgba(0,0,0,0.1)',width:(width),height:1,}}/>
                <Text style={styles.big_title}>结算</Text>
               <View style={styles.title_view}>
                    <Text style={styles.title_show_jie_e}>订单金额</Text>
                   <View style={{flex:1,}}/>
                    <Text style={styles.title_data_jie_e}>{course.price}</Text>
               </View>
                <View style={styles.title_view}>
                    <Text style={styles.title_show_jie_e}>优惠金额</Text>
                    <View style={{flex:1,}}/>
                    <Text style={styles.title_data_jie_e}>{youhui}</Text>
                </View>
                <View style={styles.title_view}>
                    <Text style={styles.title_show_jie_e}>应付金额</Text>
                    <View style={{flex:1,}}/>
                    <Text style={styles.title_data_jie_e}>{price}</Text>
                </View>
                <View style={{flexDirection:'row',backgroundColor:'rgba(0,0,0,0.1)',width:(width),height:1,marginTop:5}}/>

            </View>
        )
    }
}
const styles = StyleSheet.create({
    big_title : {
      fontWeight:'bold',
      fontSize:16,
      color:'black',
        marginTop:15,
        marginBottom:10,
        marginLeft:12,
    },
    title_show_jie_e:{
      color:'rgba(0,0,0,0.7)',
        fontWeight:'bold',
        fontSize:12,
    },
    title_data_jie_e:{
        color:'rgba(0,0,0,0.8)',
        fontSize:14,
        fontWeight:'700',
        marginRight:20,
    },
    title_view:{
        flexDirection:'row',
        backgroundColor:'white',
        marginBottom:10,
        alignItems:'center',
        marginLeft:20,
    },

})